package com.thoughtworks.opensource.yui.dd.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.RemoteService;
import com.thoughtworks.opensource.yui.dd.client.domain.MyNumberImpl;

/**
 * Created by IntelliJ IDEA.
 * Author: C. K. Sidu Ponnappa
 * Date: Nov 21, 2006
 * Time: 3:23:04 PM
 * ThoughtWorks India Pvt. Ltd.
 */
public interface DdService extends RemoteService {
    // Sample interface method of remote interface
    String getMessage(String msg);

    MyNumberImpl[] getNumbers();

    /**
     * Utility/Convinience class.
     * Use DdService.App.getInstance () to access static instance of DdServiceAsync
     */
    public static class App {
        private static DdServiceAsync app = null;

        public static synchronized DdServiceAsync getInstance() {
            if (app == null) {
                app = (DdServiceAsync) GWT.create(DdService.class);
                ((ServiceDefTarget) app).setServiceEntryPoint("/DdService");
            }
            return app;
        }
    }
}
